package com.wmada.toolkit.ffmpeg.prop;

import com.alibaba.fastjson.JSONObject;

/**
 * @author will.ma
 * @date 2020-11-3
 */
public class SubTitleInfo {

    private Integer index;
    private String  codecType;
    private String  codecName;
    private String  codecLongName;

    private String  timeBase;
    private Float   startTime;
    private Integer bitRate;
    private Float   duration;

    public Integer getIndex() {
        return index;
    }

    public void setIndex(Integer index) {
        this.index = index;
    }

    public static SubTitleInfo parse(JSONObject jsonObject) {
        SubTitleInfo info = new SubTitleInfo();
        info.index = jsonObject.getInteger("index");
        info.codecType = jsonObject.getString("codec_type");
        info.codecName = jsonObject.getString("codec_name");
        info.codecLongName = jsonObject.getString("codec_long_name");
        info.timeBase = jsonObject.getString("time_base");
        info.startTime = jsonObject.getFloat("start_time");
        info.bitRate = jsonObject.getInteger("bit_rate");
        info.duration = jsonObject.getFloat("duration");
        return info;
    }
}
